<!DOCTYPE html>
<html>
<head>
<title>掉单补单</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<#include "../../../include/resources.html">
</head>
<body style="padding:0 20px;" >
    <div class="easyui-layout" data-options="fit : true,border : false">
        <div data-options="region:'north',border:false,collapsible:false" id="searchBox">
            <div class="sLeft">
	            <form id="searchForm">
	            	<input type="text"  name="searchName" id="searchName" class="sInput" placeholder="输入收款方用户名进行搜索" /><a href="javascript:;" title="查询" class="sBtn" onclick="$.fn.dataGridOptions.searchFun('#searchForm');">查询</a><a href="javascript:;" class="advBtn" title="条件查询">条件查询 <i class="iconfont">&#xe638;</i></a>
                                    <a href="javascript:void(0);" class="reloadIcon" onclick="dataGrid.datagrid('reload');" title="刷新" ><i class="iconfont">&#xe603;</i></a>
                    <a href="javascript:;" title="查询" onclick="$.fn.dataGridOptions.searchFun('#searchForm1');">失败</a>
	            </form>
                        <form id="searchForm1">
                            <input type="hidden" name="status" value="2" />
                        </form>
            </div>
            <div class="sRight">
            	<a id="a" onclick="exportExcel();" href="javascript:void(0);" class="addBtn">导出excel</a>
            </div>
            <form id="showAdw">
		        <ul class="showAdw" style="display:none;">
		        <a href="javascript:void(0);"><i class="iconfont closeWin">&#xe63a;</i></a>
                 <li><span>状态</span>
                     <select name="status" id="status" class="type">
                         <option value="">全部</option>
                         <option value="1"> 成功</option>
                         <option value="2">失败</option>
                         <option value="0">未处理</option>
                     </select>
                 </li>
				<li><span>操作类型</span>
                     <select name="serviceType" id="serviceType" class="type">
                         <option value="">全部</option>
                         <option value="addBorrow">发布借款标</option>
                         <option value="addTender">投标</option>
                         <option value="doRepay">还款</option>
                         <option value="autoRepay">自动还款</option>
                         <option value="borrowVerifyFullSuccess">复审成功</option>
                         <option value="addBorrowFail">借款标失败</option>
                         <option value="borrowCancle">借款标取消</option>
                     </select>
                 </li>
                 <li><span> 接口类型</span>
                     <select name="tppType" id="tppType" class="type">
                         <option value="">全部</option>
                         <option value="freeze">冻结</option>
                         <option value="unFreeze">解冻</option>
                         <option value="loan">放款</option>
                         <option value="repay">还款</option>
                         <option value="transfer">转账</option>
                     </select>
                 </li>
                <li><span>收款方手机号</span><input type="text" name="toUserMobilePhone" id="toUserMobilePhone" autocomplete="off"/></li>
                <li><span>收款方姓名</span><input type="text" name="toUserRealName" id="toUserRealName" autocomplete="off"/></li>
                <li><span>付款方</span><input type="text" name="userName" id="userName" autocomplete="off"/></li>
		        <li><span>收款方</span><input type="text" name="toUserName" id="toUserName" autocomplete="off"/></li>
                <li><span>流水号</span><input type="text" name="orderId" id="orderId" autocomplete="off"/></li>               
                <li><span>标标识ID</span><input type="text" name="uuid" id="uuid" autocomplete="off"/></li>
                <li><span>时间</span><input type="text" name="startTime" id="startTime" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'endTime\')}',readOnly:true})" class="searchTime"/>&nbsp;-&nbsp;<input type="text" name="endTime" id="endTime" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'startTime\')}',readOnly:true})" class="searchTime"/></li>
	       		<li><span>&nbsp;</span><a href="javascript:void(0);" class="searchBtn sureBtn" onclick="$.fn.dataGridOptions.searchFun('#showAdw');">确定</a><a href="javascript:void(0);" class="searchBtn" onclick="$.fn.dataGridOptions.cleanFun('#searchForm');">重置</a></li>
		        </ul>
	        </form>
        </div>
        <div data-options="region:'center'" style="margin-top:30px;padding-bottom:30px;">
            <form id="scheduleManageForm" class="easyui-layout" data-options="fit:true,border : false">
                <div id="toolbar">
                        <a id="checkAll" href="javascript:void(0);" >全选</a>
                        <a id="unCheckAll" href="javascript:void(0);" >全部取消</a>
                        <a id="triggerButton" href="javascript:void(0);" >重新触发</a>
                </div>
                <table id="dataGrid"></table>
            </form>
        </div>
    </div>
</body>
</html>
<script type="text/javascript">
    var dataGrid;
    var winWidth =  900;
    var winHeight = 500;
    var verifyTitle = "查看记录";
    var verifyUrl =  "/modules/loan/borrow/tenderDetailPage.html";
    $(function() {
        dataGrid = $('#dataGrid').datagrid({
            url : '/modules/tpp/tppDispatchTaskList.html',
            fit : true,
            fitColumns : true,
            border : false,
            pagination : true,
            idField : 'id',
            pageSize : pageSize,
            pageNums :1,
            pageList : pageList,
            sortName : 'ids',
            sortOrder : 'asc',
            checkOnSelect : true,
            singleSelect:true,
            selectOnCheck : false,
            nowrap : false,
            columns : [ [
               { field: 'ids',title:'选中',width:50,align:'center',fixed:true,
                   formatter:function(value,row,index){
                       if( row.status=='1')
                       {
                           return '-';
                       }
                       else
                       {
                           return '<input type="checkbox" name="ids" value="'+row.id+'" />'
                       }
                   }
                },
              { field: 'toUserMobile', title: '收款方手机号', width: 60},
              { field: 'toUserRealName', title: '收款方姓名', width: 60},
              { field: 'tppTypeStr', title: '接口类型', width: 60},
              { field: 'userName', title: '付款方', width: 80},
              { field: 'money', title: '金额', width: 80},
              { field: 'toUserName', title: '收款方', width: 60},
              { field: 'serviceTypeStr', title: '操作类型', width: 80},
              { field: 'statusStr', title: '状态', width: 50},
              { field: 'orderId', title: '订单号', width: 85},
              { field: 'respDesc', title: '备注', width: 300},
              { field: 'addTime', title: '操作时间', width: 150,formatter:function(value,row,index){
					return getLocalTime(value,4);
				}}
              ] ],
            toolbar : '#toolbar'
        });
    });

//重新触发按钮
$("#checkAll").click(function(){
    $('input[type="checkbox"]').each(function(){
        $(this).attr("checked",true);
    })
})
$("#unCheckAll").click(function(){
     $('input[type="checkbox"]').each(function(){
        $(this).attr("checked",false);
    })
})
$("#triggerButton").click(function(){
    var flag = false;
    $('input[type="checkbox"]').each(function(){
        if($(this).attr("checked"))
        {
            flag = true;
        }
    })
    if(flag)
    {
        $("#scheduleManageForm").ajaxSubmit({
            url:'/modules/tpp/tppDispatchTask.html',
            dataType:'json',
            success:function(data){
                if(data.result)
                {
                    $.messager.alert('提示','触发成功！');
                    dataGrid.datagrid('reload');
                }
                else
                {
                    $.messager.alert('提示','触发失败！');
                    dataGrid.datagrid('reload');
                }
            }
        });
    }
    else
    {
        $.messager.alert('提示','请选择至少选中一个');
    }
    
})

function exportExcel(){
	var url = "/modules/tpp/exportExcelList.html";
	var status = $("#status").val()
	var serviceType = $("#serviceType").val();
	var tppType = $("#tppType").val();
	var toUserMobilePhone = $("#toUserMobilePhone").val();
	var toUserRealName = $("#toUserRealName").val();
	var userName = $("#userName").val();
	var ordId = $("#ordId").val();
    var uuid=$("#uuid").val();
	var startTime = $("#startTime").val();
	var endTime = $("#endTime").val();
	var sou = "?status=" + status + "&serviceType=" + serviceType + "&tppType=" + tppType
			+ "&toUserMobilePhone=" + toUserMobilePhone+ "&toUserRealName=" + toUserRealName + "&userName=" + userName
			+ "&ordId=" + ordId + "&uuid=" + uuid + "&startTime=" + startTime + "&endTime=" + endTime;
	window.location.href = url + sou;
}
</script>
<script src="${theme_dir}/js/search.js"></script>

